def quantize(x, scale, zero_point):
    # 先缩放，再四舍五入，最后加上zero_point
    return np.clip(np.round(x / scale) + zero_point, -128, 127).astype(np.int8)

def dequantize(x, scale, zero_point):
    # 先减去zero_point，再乘以scale
    return (x - zero_point) * scale 